package com.masterrabbit.sn.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.masterrabbit.common.core.web.domain.AjaxResult;
import com.masterrabbit.sn.domain.Reviews;
import com.masterrabbit.sn.service.ReviewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/reviews")
public class ReviewsController {
    @Autowired
    private ReviewsService reviewsService;

    @GetMapping("/getReviews/{userMerchantId}")
    public AjaxResult getReviews(@PathVariable Integer userMerchantId,
                                 @RequestParam(defaultValue = "1") int pageNum,
                                 @RequestParam(defaultValue = "7") int pageSize) {
        return AjaxResult.success(reviewsService.getReviews(pageNum, pageSize, userMerchantId));
    }
    /**
     * 查看评论详情
     */
    @GetMapping("/getReviewsDetails/{reviewId}")
    public AjaxResult getReviewsDetails(@PathVariable Integer reviewId) {
        return AjaxResult.success(reviewsService.getReviewsById(reviewId));
    }
}
